import com.alibaba.fastjson.JSONObject;
import com.api.customization.fenbeitong.AccessTokenApi;
import com.api.customization.fenbeitong.OrderResultApi;
import com.yunzhou.utils.HttpClientUtils;
import com.yunzhou.utils.LogTool;
import org.junit.Test;
import weaver.conn.RecordSet;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;

import java.util.*;

/**
 * @Author Huangwm
 * @Date 2022-06-15
 * @Version 1.0
 * @Description TODO
 **/
public class main {
    @Test
    public  static void  main(String args[]) throws Exception {
//        PuAppVouchBody puAppVouchBody = new PuAppVouchBody();
//        puAppVouchBody.setShdz("收获地址");
//        System.err.println(puAppVouchBody.getShdz());
//        System.err.println(JSONObject.toJSONString(puAppVouchBody));
//        String rootPath = "E:\\WEAVER9\\ecology\\";
//        GCONST.setRootPath(rootPath);
//        GCONST.setServerName("ecology");
//        User user = new User(3);
//        HttpClientUtils client = new HttpClientUtils();
//        Map<String,String> params = new HashMap<>();
//        params.put("tp_mobile",user.getMobile());
//        params.put("app_id","6311cea7039a98413b874848");
//        params.put("app_key","6311cf1a8b9b335f1e4a0658");
////        String result1 = client.post("http://open-plus-fat2.fenbeijinfu.com/open/api/auth/v1/dispense",params);
////        JSONObject infos = JSONObject.parseObject(client.post("http://open-plus-fat2.fenbeijinfu.com/open/api/auth/v1/dispense", params));
////        String token =infos.getJSONObject("data").getString("access_token");
////
//
//        String result = client.ajaxPostJson("http://open-plus-fat2.fenbeijinfu.com/open/web/auth/v1/dispense",JSONObject.toJSONString(params));
//        System.err.println(result);
//
//        List<String > dates = new ArrayList<>();
//        dates.add("2022-09-01");
//        dates.add("2022-09-02");
//        dates.add("2022-09-03");
//        dates.add("2022-09-04");
//        String max = Collections.max(dates);
//        String min = Collections.min(dates);
//        System.err.println(max+" "+min);
//
        Map<String, Object> params = new HashMap<>();
        params.put("docid","1,2");
//        params.put("dates",dates);
//        JSONObject newParams = new JSONObject(params);
//        System.err.println(newParams.getJSONArray("dates1")!=null);

//        OrderResultApi orderResultApi = new OrderResultApi();
        //System.err.println(orderResultApi.cancel(params));

        //费用归属对象集合
//        List<Map<String,Object>> new_cost_attributions = new ArrayList<>();
//        //费用归属 - 部门 start
//        Map<String,Object> cost_dep_main = new HashMap<>();
//        cost_dep_main.put("type","1");
//        cost_dep_main.put("third_archive_id","feiygsbm");//费用归属部门
//        cost_dep_main.put("archive_name","feiygsbm");//费用归属部门
//        List<Map<String,Object>> cost_dep_details = new ArrayList<>();
//        Map<String,Object> cost_dep_d1 = new HashMap<>();//费用归属 - 部门
//        cost_dep_d1.put("third_id","feiygsbm");
//        cost_dep_d1.put("name","feiygsbm");
//        cost_dep_details.add(cost_dep_d1);
//        cost_dep_main.put("details",cost_dep_details);
//        new_cost_attributions.add(cost_dep_main);
//
//        //System.err.println(new_cost_attributions);
//
//        int count = 1388;
//        System.err.println(count/100);
//        for(int i=1;i<=(count/100)+1;i++){
//            //System.err.println(i);
//        }
//
//
//        String exis_bm = "112,221,117,222,113,194,223,200,162,116,218,220,219,224";
//        System.err.println(exis_bm.indexOf("22"));

//        String str = "公司名称:云洲智能科技股份有限公司,出厂编号:YZSL20Y0001,产品型号:SL20,".replaceAll("\r\n","");
//        String[] obj = str.split(",");
//        String companyname = "";
//        String code = "";
//        String model = "";
//        for(int i=0;i<obj.length;i++){
//            String txt = obj[i];
//            if(txt.indexOf("公司名称")>=0){
//                companyname = obj[i].split(":")[1];
//            }else if(txt.indexOf("编号")>=0){
//                code = obj[i].split(":")[1];
//            }else if(txt.indexOf("型号")>=0){
//                model = obj[i].split(":")[1];
//            }
//        }
//        System.err.println(companyname);
//        System.err.println(code);
//        System.err.println(model);

        System.err.println("with Department as(select * from HrmDepartment where id='"+1+"'\n" +
                "union all select d.* from Department,HrmDepartment d where Department.supdepid=d.id)\n" +
                "select id from Department where supdepid=0");
    }
}
